/*
 * Copyright 2020-2021 redragon.dongbin
 *
 * This file is part of redragon-erp/赤龙ERP.

 * redragon-erp/赤龙ERP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.

 * redragon-erp/赤龙ERP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with redragon-erp/赤龙ERP.  If not, see <https://www.gnu.org/licenses/>.
 */
package com.erp.order.poa.dao.model;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;


import lombok.Data;

@Data
@MappedSuperclass
public class PoAgreementHeadBase {

    //Constructors
    public PoAgreementHeadBase() {
    }
    
    //Fields

    //合同id
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "po_head_id")
    private Integer poHeadId;

    // 合同名称
    @NotBlank(message="{name.NotBlank}")
    @Column(name = "po_name" )
    private String poName;

    //合同单号
    @Column(name = "project_code" )
    private String projectCode;

    // 合同编码
    @NotBlank(message="{code.NotBlank}")
    @Column(name = "po_head_code" )
    private String poHeadCode;

    // 签订单位
    @NotBlank(message="签订单位不能为空")
    @Column(name = "vendor_code" )
    private String vendorCode;

    // 发起单位
    @NotBlank(message="发起单位不能为空")
    @Column(name = "sponsor_code" )
    private String sponsorCode;

    // 合同性质
    @Column(name = "tax_type" )
    private String taxType;

    // 合同类别
    @Column(name = "tax_percent" )
    private String taxPercent;

    // 合同类型
    @NotBlank(message="合同类型不能为空")
    @Column(name = "po_type" )
    private String poType;

    // 实施站点
    @Column(name = "org_code" )
    private String orgCode;

    // 实施部门
    @Column(name = "department_code" )
    private String departmentCode;

    // 使用方向描述
    @Column(name = "po_desc" )
    private String poDesc;

    // 合同附件
    @Column(name = "po_att" )
    private String poAtt;

    // 结算方式
    @Column(name = "settle_style" )
    private String settleStyle;

    // 实施地点
    @Column(name = "construction_site" )
    private String constructionSite;

    // 合同来源方式
    @Column(name = "source_mode" )
    private String sourceMode;

    // 审批表档案号
    @Column(name = "approval_file_no" )
    private String approvalFileNo;

    // 补充描述
    @Column(name = "add_desc" )
    private String addDesc;

    // 填报日期
    @Column(name = "start_date" )
    private Date startDate;

    // 终止日期
    @Column(name = "end_date" )
    private Date endDate;

    // 创建时间
    @Column(name = "created_date" )
    private Date createdDate;

    // 创建人
    @Column(name = "created_by" )
    private String createdBy;

    // 最后修改时间
    @Column(name = "last_updated_date" )
    private Date lastUpdatedDate;

    // 最后修改人
    @Column(name = "last_updated_by" )
    private String lastUpdatedBy;

    // 审批通过时间
    @Column(name = "sign_date" )
    private Date signDate;

    // 是否为据实结算
    @Column(name = "is_real_settle" )
    private String isRealSettle;

    // 合同金额
    @Column(name = "poa_amount" )
    private BigDecimal poaAmount;

    // 货币币种
    @NotBlank(message="币种不能为空")
    @Column(name = "currency_code" )
    private String currencyCode;

    // 质保金额
    @Column(name = "warranty_amount" )
    private String warrantyAmount;

    // 质保期限
    @Column(name = "warranty_period" )
    private String warrantyPeriod;

    // 合同预估金额
    @Column(name = "prepay_amount" )
    private BigDecimal prepayAmount;

    // 供应商id
    @Column(name = "staff_code" )
    private String staffCode;

    // 供应商付款方式
    @Column(name = "payment_method" )
    private String paymentMethod;

    // 合同谈判参与人员
    @Column(name = "po_participants" )
    private String poParticipants;

    // 版本
    @Column(name = "version" )
    private Integer version;

    // 状态（草稿NEW，生效CONFIRM，变更ALTER，到期终止FINISH，未到期合同终止CANCEL）
    @Column(name = "status" )
    private String status;

    // 审批状态（未提交UNSUBMIT、待审批SUBMIT、审批中APPROVE、已驳回REJECT、审批完结COMPLETE）
    @Column(name = "approve_status" )
    private String approveStatus;

    // 接收状态（未入库N，已入库Y，部分入库PART）
    @Column(name = "receive_status" )
    private String receiveStatus;

    // 付款状态（未付款N，已付款Y，部分付款PART）
    @Column(name = "payment_status" )
    private String paymentStatus;

    //合同签批流程实例id
    @Column(name = "process_instance_id", unique = false, nullable = true, length = 64)
    private String processInstanceId;

    //合同终止流程实例id
    @Column(name = "stop_process_instance_id", unique = false, nullable = true, length = 45)
    private String stopProcessInstanceId;

    //合同申请终止原因
    @Column(name = "stop_reason", unique = false, nullable = true, length = 45)
    private String stopReason;

    //附件地址
    @Column(name = "file_url", unique = false, nullable = true, length = 255)
    private String fileUrl;

    //是否双方签字盖章
    @Column(name = "is_sign", unique = false, nullable = true, length = 10)
    private String isSign;

    //归档时间
    @Column(name = "archived_date")
    private Date archivedDate;
    //归档人
    @Column(name = "archived_by")
    private String archivedBy;
    //归档部门
    @Column(name = "archived_depart")
    private String archivedDepart;
    //归档附件
    @Column(name = "archived_fileurl")
    private String archivedFileurl;

    
    
    /*
         * 用于展示的字段
     */
    @Transient
    private String staffName;
    @Transient
    private String departmentName;
    @Transient
    private BigDecimal amount;
    @Transient
    private String vendorContactDesc;


}